<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>键盘事件</title>
    <meta http-equiv="X-UA-Compatible" content="chrome=1" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="renderer" content="webkit">
    <meta name="author" content="yb">
    <meta name="keywords" content="关键词" />
    <meta name="description" content="描述" />
    <meta http-equiv="Pragma" content="no-cache">
    <meta http-equiv="Cache-Control" content="no-cache, must-revalidate">
    <meta http-equiv="Expires" content="0">
    <!-- <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" /> -->
    <script src="https://cdn.bootcss.com/jquery/1.10.1/jquery.min.js"></script>
    <link rel="stylesheet" href="../style/css/base.css">
    <style>
        iframe{
            width: 100%;
            height: 100%;
            border-top-width: 0px;
            border-right-width: 0px;
            border-bottom-width: 0px;
            border-left-width: 0px;
            border-style: inset;
            border-color: initial;
            border-image: initial;
        }
        iframe::before,
        iframe::after{
            box-sizing: border-box;
        }
    </style>
</head>
<body>
   <p class="tag">13213132133132132</p> 
   <iframe src="./long.html" frameborder="0" id="frmMain" name="frmMain" width="99%" height="100%" scrolling="no" marginHeight="0" onload="javascript:SetWinHeight(this)"></iframe>
</body>
<script>
    
    $('body').keyup (function(e){
        e.preventDefault();
        console.log('keyCode = '+e.keyCode);
    })

    // var docu = document.getElementsByTagName('html,body');
    // console.log(docu);
    // docu.onkeydown = function (event) {  
    //     console.log(event);
    //     if (event.keyCode == 116) {  
    //         event.preventDefault();
    //         window.history.go(-1);//返回上一页                
    //     }  
    // }

    function SetWinHeight(obj){
        var win = obj;
        if(document.getElementById){
            if(win && !window.opera){
                if(win.contentDocument && win.contentDocument.body.offsetHeight){
                    win.height = win.contentDocument.body.offsetHeight;

                }else if(win.Document && win.Document.body.scrollHeight){
                    win.height = win.Document.body.scrollHeight;

                }
            }
        }
    }
    var value = 'm';
    $obj = {a: 'm'};
    Object.defineProperty($obj, 'a', {
        get(){
            if(value === 'm'){
                value = 'n';
                return 'm';
            }
            return value;
        }
    });
    if($obj.a === 'm' && $obj.a === 'n'){
        console.log('123');
    }
</script>